"""
-*- coding:utf-8 -*-
__project__ = 'le-bo16'
__file_name__ = 'rickey'
__author__ = 'RickeyTing'
__time__ = '2020/10/27 19:36'
__product_name = PyCharm
# code is far away from bugs with the god animal protecting
    I love animals. They taste delicious.
              ┏┓      ┏┓
            ┏┛┻━━━┛┻┓
            ┃        ┃
            ┃  ┳┛  ┗┳  ┃
            ┃      ┻      ┃
            ┗━┓      ┏━┛
                ┃      ┗━━━┓
                ┃  神兽保佑    ┣┓
                ┃　永无BUG！   ┏┛
                ┗┓┓┏━┳┓┏┛
                  ┃┫┫  ┃┫┫
                  ┗┻┛  ┗┻┛
"""


import random
# guessGame_list = ['石头','剪刀','布']
# rules =[['石头','剪刀'],['剪刀','布'],['布','石头']]
# computer = random.choice(guessGame_list)
# player = input("石头，剪刀，布：\n").strip()
# print(computer)
# result = True
# while result:
#     if player not in guessGame_list:
#         player = input("石头，剪刀，布：\n").strip()
#     else:
#         result = False
# if player ==computer:
#     print('平局!!!')
# elif [computer,player] in rules:
#     print('很遗憾，玩家输了!!!')
# else:
#     print('恭喜你，玩家赢了!!!')
#     print('退出游戏')



# my_list = []
# for i in range(5):
#     a = random.randint(0, 100)
#     my_list.append(-a)
# print(my_list)
#
#
# #i = random.random()
# a = [1,2,3,4]
# b = [5,6,7,8]
# a.extend(b)
# print(a)


# def my_func(a,b):
#     """
#     #todo: 这次不标注，下回想起了再来！
#     :param a:
#     :param b:
#     :return:
#     """

print(sum(range(1, 101)))


# 1! 1 * 2
def my_func(num):
    if num >1:
        return num * my_func(num-1)
    else:
        return 1
print(my_func(5))



#写入/读取参数
file = open('lele.txt',mode='wb')
file.write('iloveyou'.encode())
file.close()

file = open('lele.txt',mode='rb')
ret = file.read().decode()
print(ret)
file.close()


#有参数的匿名函数。
F = lambda a: print("lele")
F(1)

#一步完成列表推导式，一条数据且有循环
print([i for i in range(1,11) if i % 2 == 0])
#多条数据。
print([(i , j) for i in range(1,11) for j in range(2,9)],'\n')


#[1,2,3,4,5,6......100]====[[1,2,3],[4,5,6]......]
a = [i for i in range(1,101)]
b = []
for i in range(2,len(a), 3):
    ret = [i-1, i, i+1]
    b.append(ret)
print(b,'\n')

#列表推导式一步写出103行需求。
print([a[i:i+3] for i in range(0, len(a), 3)],'\n')







